package utils;

import org.apache.log4j.Logger;

import utils.getcode.GetToken;
import weibo4j.Weibo;
import weibo4j.http.AccessToken;

public class GetWeibo {
	
	private static final Logger log = Logger.getLogger(GetWeibo.class);

	public static Weibo getWeibo(){
		Weibo weibo = null;
		
		System.setProperty("weibo4j.oauth.consumerKey", Weibo.CONSUMER_KEY);
    	System.setProperty("weibo4j.oauth.consumerSecret", Weibo.CONSUMER_SECRET);
		try {
			weibo = new Weibo();
			
			GetToken gt = new GetToken(); 
			AccessToken at = gt.getAccessToken();
			weibo.setToken(at);
			
		} catch (Exception e) {
			log.debug(e);
		}
		
		return weibo;
	}
}
